﻿namespace System.ServiceModel.DomainServices.Client
{
    using System;
    using System.ComponentModel.DataAnnotations;
    using System.Diagnostics;
    using System.Reflection;
    using System.Runtime.CompilerServices;

    [DebuggerDisplay("Name = {Member.Name}")]
    internal sealed class MetaMember
    {
        public MetaMember(System.ServiceModel.DomainServices.Client.MetaType metaType, PropertyInfo propertyInfo)
        {
            this.Member = propertyInfo;
            this.MetaType = metaType;
        }

        public object GetValue(object instance)
        {
            return this.Member.GetValue(instance, null);
        }

        public System.ComponentModel.DataAnnotations.EditableAttribute EditableAttribute { get; set; }

        public bool IsAssociationMember { get; set; }

        public bool IsCollection { get; set; }

        public bool IsComplex { get; set; }

        public bool IsDataMember { get; set; }

        public bool IsKeyMember { get; set; }

        public bool IsRoundtripMember { get; set; }

        public PropertyInfo Member { get; private set; }

        public System.ServiceModel.DomainServices.Client.MetaType MetaType { get; private set; }

        public bool RequiresValidation { get; set; }
    }
}

